﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QLKhachSan.DTO;
using System.Data;
using System.Data.SqlClient;

namespace QLKhachSan.DAO
{
    public class DAO_DatTiec
    {
        public static void themDatTiec(DTO_DatTiec p)
        {
            string[] name = new string[3] { "@MaKH","@MaNV","@DaTra" };
            object[] ob = new object[3] { p.MaKH,  p.MaNV,p.DaTra };
            clsKetNoi.ThucThiLenhCoTS("pr_ThemDatTiec", name, ob, 3);
        }
        public static DataTable hienthiDanhSachDatTiec()
        {
            return clsKetNoi.Load("pr_HienThiDatTiec");
        }

        public static void xoaDatTiec(DTO_DatTiec p)
        {
            string[] name = new string[1] { "@MaDatTiec" };
            object[] ob = new object[1] { p.MaDatTiec };
            clsKetNoi.ThucThiLenhCoTS("pr_XoaDatTiec", name, ob, 1);
        }
      
        public static DataTable hienthiDanhSachDatTiecDeInTheoMaDatTiec(DTO_DatTiec p)
        {
             string[] name = new string[1] { "@MaDatTiec" };
             object[] ob = new object[1] { p.MaDatTiec };
             return clsKetNoi.LoadCoTS("pr_HienThiDatTiecDeInTheoMaDatTiec", name, ob, 1);
        }
        public static void suaDatTiecTheoDaTra(DTO_DatTiec p)
        {
            string[] name = new string[2] { "@MaDatTiec", "@DaTra" };
            object[] ob = new object[2] {p.MaDatTiec, p.DaTra };
            clsKetNoi.ThucThiLenhCoTS("pr_SuaDatTiecTheoDaTra", name, ob, 2);
        }
    }
}
